/*
JETware Hands-free Extension provides additional features for Windows Mobile HFP support.
Copyright (C) 2004-2009 Jim Thatcher

This program is free software; you can redistribute it and/or modify it under the terms of the 
GNU General Public License as published by the Free Software Foundation; version 2 of the License.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; 
if not, write to the Free Software Foundation, Inc., 
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Defines classes for ObexClient for BT Object Push

#include "windows.h"
#include "winsock2.h"
#include "ws2bth.h"
// #include "bthapi.h"
#include "obex.h"
#include "ObexHeaders.h"

class ObexClient
{
	// Constructors and destructors
public :
	ObexClient ();
	virtual ~ObexClient()
	{
		if (m_socket != INVALID_SOCKET)
			closesocket(m_socket);
		// delete any outstanding requests
	};

	// BYTE ParseResponse();
	BOOL Connect(bt_addr ullTarget);
	void Disconnect();
	BOOL Put(TCHAR * szFile);
	void Get();
	void SetPath();
	void Abort();
protected:
	// WORD SendResponse(BYTE * pResponse, WORD wResponseLen);

	// BOOL	IsRequestFinal() { return m_bReqFinal; };
	BOOL	IsResponseFinal() { return m_bResFinal; };
	WORD	MaxPacketSize() { return m_wMaxPacketSize; };
	CHAR *	Target() { return m_szTarget; };

private :
	// CONNECTION_STATE	m_bState;
	BYTE	m_bPacketBuffer[1024];
	BYTE *	m_pRespBuffer;
	SOCKET	m_socket;
	// might move these to a SyncRequest class
	// BOOL	m_bReqFinal;
	BYTE	m_bCmd;
	BYTE	m_bResponseCode;
	BOOL	m_bResFinal;
	WORD	m_wMaxPacketSize;
	CHAR	m_szTarget[64];
};
